package com.fjzx.androidframe.base.application;

import android.app.Application;
import android.content.ComponentCallbacks;
import android.content.Context;
import android.content.res.Configuration;

/**
 * Application代理
 * <p>
 * 组件化开发过程中发现，组件中可能需要使用Application，或者可能需要在Application中初始化一些库，
 * 因此封装一个Application的代理，组件自实现这个代理类，并注册到主App中。
 * 组件可认为这个App代理就是组件的Application
 *
 * @author xiongyongcong
 */
public abstract class AppDelegate {
    private boolean debug;

    public boolean isDebug() {
        return debug;
    }

    public void setDebug(boolean debug) {
        this.debug = debug;
    }

    public abstract void attachBaseContext(Context base, Application app);

    public abstract void onCreate();

    public void onTerminate() {
    }

    public void onLowMemory() {
    }

    public void onTrimMemory(int level) {
    }

    public void onConfigurationChanged(Configuration newConfig) {
    }

    public void registerComponentCallbacks(ComponentCallbacks callback) {
    }

    public void unregisterComponentCallbacks(ComponentCallbacks callback) {
    }

    public void registerActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callback) {
    }

    public void unregisterActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callback) {
    }

    public void registerOnProvideAssistDataListener(Application.OnProvideAssistDataListener callback) {
    }

    public void unregisterOnProvideAssistDataListener(Application.OnProvideAssistDataListener callback) {
    }
}
